"""
4、从键盘输入n，求1!+2!+3!+…+n!。用for实现。
(文件名：py0107.py)
"""
n = int(input("请输入一个整数n:"))
sum_, i, j, fact_ = 0, 1, 1, 1
for i in range(1, n + 1, 1):
    for j in range(1, i + 1, 1):
        fact_ *= j
    sum_ += fact_
    fact_ = 1
print("1!+2!+...+%d! = %d" % (n, sum_))
